<?php
header("Access-Control-Allow-Origin: *");
class MobileAction extends CommonAction {

    public function index(){
        //查询精选商标
        $list = M('trademarks_best')
            ->field('*')
            ->where(array('is_deleted' => 0, 'status' => 1))
            ->order('top DESC, top_time DESC, sort DESC, updated_at DESC, id DESC')
            ->select();
        if ( !empty($list) ) {
            foreach ($list as $k => $v) {
                $list[$k]['cat_name'] = $this->getCategory($v['cate']);
                if( !empty($v['goods_name']) ) {
                    $list[$k]['goods_service'] = explode("；",$v['goods_name']);
                }
                if( !empty($v['group_sn']) ) {
                    $list[$k]['goods_sn'] = explode("；",$v['group_sn']);
                }
                $list[$k]['apply_time'] = !empty( $v['apply_time'] ) ? mb_substr($v['apply_time'],0,10, 'utf-8') : "";
                $list[$k]['registered_time'] = !empty( $v['registered_time'] ) ? mb_substr($v['registered_time'],0,10, 'utf-8') : "";
                //计算最新价格
                $newprice = intval($v['price'] * (100 + $this->buyFasterRate) / 100);
                if( $newprice < ($v['price'] + $this->buyFasterLow) ){
                    $list[$k]['price'] = $v['price'] + $this->buyFasterLow;
                }else if( $newprice > ($v['price'] + $this->buyFasterHigh) ){
                    $list[$k]['price'] = $v['price'] + $this->buyFasterHigh;
                }else{
                    $list[$k]['price'] = $newprice;
                }
            }
        }
        $this->assign('list',$list);
        $this->display('Mobile2024:index');
    }

    public function product(){
        //当前页码
        $page = $this->_get('page', 'intval');
        //分类
        $cidlist = [];
        $cid = $this->_get("cid","intval");
        if( $cid > 0 ){
            array_push($cidlist,$cid);
        }
        //商标类别
        $leis = $this->_get("leis","trim");
        if( mb_strlen($leis) > 0 ){
            //如果选择了筛选分类，则默认分类置空
            $cid = 0;
            $cidlist = explode("-",$leis);
        }
        //类似群组
        $teams = $this->_get("teams","trim");
        //选中的产品
        $wordv = $this->_get("wordv","trim");
        $wordvlist = [];
        if( mb_strlen($wordv) > 0 ){
            $wordvlist = explode("-",$wordv);
        }
        //开始价格
        $ps = $this->_get("ps","intval");
        //结束价格
        $pe = $this->_get("pe","intval");
        //价格区间类型
        $pt = $this->_get("pt","intval", 0);
        //名称组合类型
        $nt = $this->_get("nt","trim");
        //名称长度
        $ns = $this->_get("ns","trim");
        //搜索内容
        $text = $this->_get("text",'trim');
        //价格由低到高,排序规则，1.价格由低到高 2.价格由高到低 3.新上传的在前面 4.新上传的在后面 5.星星由高到低 0.默认排序
        $order = $this->_get("order", "intval");
        if( empty($order) || $order > 5 || $order < 1 ){
            $order = 5;
        }
        //同名标仅显示一个类别
        $distinct = $this->_get("distinct", "intval");
        if( $distinct == 1 ){
            $distinct = true;
        }else{
            $distinct = false;
        }
        //接口请求地址
        $apiUrl = 'https://biaobiaoku.com/api/search?';
        $param = array();
        $param["ip"] = empty($_SERVER["REMOTE_ADDR"]) ? "47.102.187.210" : $_SERVER["REMOTE_ADDR"];
        $param["current"] = empty($page) ? 1 : $page;
        $param["limit"] = 100;
        $param["textType"] = '智能';
        $param["searchMode"] = 3;
        $param["sqNum"] = "1-80";//注册人申请量 1-90
        if( !empty( $text ) ){
            $param["text"] = $text;
        }
        if( !empty( $cid ) ){
            $param["leis"] = $cid;
        }
        if( !empty($leis) ) {
            $leiArr = explode("-", $leis);
            if( !empty($leiArr) ){
                $param["leis"] = implode(",", $leiArr);
            }
        }
        if( !empty($teams) ) {
            $teamsArr = explode("-", $teams);
            if( !empty($leiArr) ){
                $param["teams"] = implode(",", $teamsArr);
            }
        }
        $param["orderCode"] = $order;
        $param["distinct"] = $distinct;
        $ntArr = [];
        if( !empty($nt) ) {
            $ntArr = explode("-", $nt);
            if( !empty($ntArr) ) {
                $param["types"] = implode(",", $ntArr);
            }
        }
        $nsArr = [];
        if( !empty($ns) ) {
            $nsArr = explode("-", $ns);
            if( !empty($nsArr) ) {
                $param["nameSizeList"] = implode(",", $nsArr);
            }
        }
        //价格区间筛选
        if( $pt >= 1 && $pt <= 6 && $ps == 0 && $pe == 0 ){
            if( $pt == 1 ){
                $param["priceStart"] = $this->getPriceParam('ps', 0);
                $param["priceEnd"] = $this->getPriceParam('pe', 3000);
            }elseif( $pt == 2 ){
                $param["priceStart"] = $this->getPriceParam('ps', 3000);
                $param["priceEnd"] = $this->getPriceParam('pe', 5000);
            }elseif( $pt == 3 ){
                $param["priceStart"] = $this->getPriceParam('ps', 5000);
                $param["priceEnd"] = $this->getPriceParam('pe', 8000);
            }elseif( $pt == 4 ){
                $param["priceStart"] = $this->getPriceParam('ps', 8000);
                $param["priceEnd"] = $this->getPriceParam('pe', 10000);
            }elseif( $pt == 5 ){
                $param["priceStart"] = $this->getPriceParam('ps', 10000);
                $param["priceEnd"] = $this->getPriceParam('pe', 15000);
            }elseif( $pt == 6 ){
                $param["priceStart"] = $this->getPriceParam('ps', 15000);
                $param["priceEnd"] = $this->getPriceParam('pe', 18000);
            }
        }
        //自定义价格筛选
        if( $pt == 0 && ( $ps > 0 || $pe > 0 ) ){
            //开始价格
            if ($ps > 0) {
                $param["priceStart"] = $this->getPriceParam('ps', $ps);
            }
            //结束价格
            if ($pe > 0) {
                $param["priceEnd"] = $this->getPriceParam('pe', $pe);
            }
        }
        //屏蔽3万以上的标的
        if( !isset($param["priceEnd"]) || intval($param["priceEnd"]) > 18000 ){
            $param["priceEnd"] = 18000;
        }
        $apiUrl = $apiUrl . http_build_query($param);
        //缓存初始化条件
        $cacheKey = "naonaodashi_mobile_" + md5($apiUrl);
        $cacheValue = $this->redis_cache->get($cacheKey);
        if( empty($cacheValue) ){
            $res = file_get_contents($apiUrl);
            $response = json_decode($res, true, JSON_UNESCAPED_UNICODE);
            if ( $response['code'] == 0) {
                $total = $response['data']['total'];
                $list = $response['data']['results'];
                if ( !empty($list) ) {
                    $vos = array();
                    foreach ($list as $k => $v) {
                        $vos[$k]['id'] = $v['id'];
                        $vos[$k]['lei'] = $v['lei'];
                        $vos[$k]['lei_name'] = $this->getCategory($v['lei']);
                        $vos[$k]['name'] = $v['name'];
                        $vos[$k]['brandId'] = $v['brandId'];
                        if( !empty($v['goods']) ) {
                            $vos[$k]['goods_service'] = explode("；",$v['goods']);
                        }
                        if( !empty($v['team']) ) {
                            $vos[$k]['goods_sn'] = explode("；",$v['team']);
                        }
                        if( !empty($v['brother']) ) {
                            $vos[$k]['brother_cate'] = explode(";",$v['brother']);
                        }
                        $vos[$k]['goods_service_num'] = $v['xxNum'];
                        //$vos[$k]['thumb_image'] = "https://color.picer.cdn.biaobiaoku.com/" . $v['brandId'] . "-" . $v['picHash'] . "-250.png";
                        //$vos[$k]['trademark_image'] = "https://brand.picer.cdn.biaobiaoku.com/" . $v['brandId'] . "-" . $v['picHash'] . ".jpg";
                        $vos[$k]['thumb_image'] = $this->getImageUrl($v,2);
                        $vos[$k]['trademark_image'] = $this->getImageUrl($v,0);
                        //计算最新价格
                        $newprice = intval($v['price'] * (100 + $this->buyFasterRate) / 100);
                        if( $newprice < ($v['price'] + $this->buyFasterLow) ){
                            $vos[$k]['price'] = $v['price'] + $this->buyFasterLow;
                        }else if( $newprice > ($v['price'] + $this->buyFasterHigh) ){
                            $vos[$k]['price'] = $v['price'] + $this->buyFasterHigh;
                        }else{
                            $vos[$k]['price'] = $newprice;
                        }
                    }
                }
                $totalPage = 0;
                if( $total >0 ){
                    $totalPage = ceil( $total / $param["limit"] );
                }
                //响应
                $trademarks = ['code' => 0, 'msg' => '', 'data' => ['text' => $response['msg'], 'total' => $total, 'totalPage' => $totalPage, 'list' => $vos]];
                $cacheValue = json_encode($trademarks);
                $this->redis_cache->set($cacheKey, $cacheValue, 2);
                $this->assign('cacheValue',$cacheValue);
                $this->assign('trademarks',$trademarks);
                $this->assign('totalPage',$totalPage);
            }
        }else{
            $trademarks = json_decode($cacheValue,true,JSON_UNESCAPED_UNICODE);
            $this->assign('cacheValue',$cacheValue);
            $this->assign('trademarks',$trademarks);
            $this->assign('totalPage',empty( $trademarks["data"]['totalPage'] ) ? 0 : $trademarks["data"]['totalPage'] );
        }
        $this->assign('ps',$ps);
        $this->assign('pe',$pe);
        $this->assign('pt',$pt);
        $this->assign('nt',$ntArr);
        $this->assign('ns',$nsArr);
        $this->assign('cid',$cid);
        $this->assign('cidlist',$cidlist);
        $this->assign('wordvlist',$wordvlist);
        $this->assign('cidlistlen', empty($cidlist) ? 0 : count($cidlist) );
        $this->assign('wordvlistlen', empty($wordvlist) ? 0 : count($wordvlist) );
        $this->assign('text',$text);
        $this->assign('order',$order);
        $this->assign('page',$param["current"]);
        $this->assign('category',$this->getCategoryDetail());
        $this->display('Mobile2024:product');
    }

    public function getCondition(){
        $data = [];
        $category = $this->getCategoryDetail();
        $data['category'] = $category;
        $data['priceType'] = array(
            ['val' => 1, 'name' => '0-3千'],
            ['val' => 2, 'name' => '3-5千'],
            ['val' => 3, 'name' => '5-8千'],
            ['val' => 4, 'name' => '8-1万'],
            ['val' => 5, 'name' => '1-1.5万'],
            ['val' => 6, 'name' => '1.5-1.8万']
        );
        $data['nameType'] = array(
            ['val' => 1, 'name' => '纯中文'],
            ['val' => 2, 'name' => '纯英文'],
            ['val' => 3, 'name' => '中文+英文'],
            ['val' => 4, 'name' => '纯数字'],
            ['val' => 5, 'name' => '中文+数字'],
            ['val' => 6, 'name' => '英文+数字'],
            ['val' => 8, 'name' => '纯图形']
        );
        $data['nameSize'] = array(
            ['val' => 1, 'name' => '1个字'],
            ['val' => 2, 'name' => '2个字'],
            ['val' => 3, 'name' => '3个字'],
            ['val' => 4, 'name' => '4个字'],
            ['val' => 5, 'name' => '5个字'],
            ['val' => 6, 'name' => '6个字'],
            ['val' => 7, 'name' => '7个字'],
            ['val' => 8, 'name' => '8个字'],
            ['val' => 9, 'name' => '9个字']
        );
        $data['orderBy'] = array(
            ['val' => 1, 'name' => '价格由低到高']
        );
        echo json_encode(['code' => 0, 'msg' => "获取成功", 'data' => $data],JSON_UNESCAPED_UNICODE);
        exit;
    }

    public function search(){
        //参数
        $param = array();
        $param["ip"] = empty($_SERVER["REMOTE_ADDR"]) ? "47.102.187.210" : $_SERVER["REMOTE_ADDR"];
        //当前页码
        $param["current"] = $this->_post('current', 'intval');
        //每页条数
        $param["limit"] = $this->_post('limit', 'intval');
        //搜索类型，可选项有:0智能,1商标名,2注册号,3申请人
        $param["textType"] = '智能';
        //搜索模式 可选项有: 0至少包含一个字 1.开头包含 3.包含全部 4.精准匹配 默认是3
        $param["searchMode"] = 3;
        //搜索内容
        $text = $this->_post("text",'trim');
        if( !empty($text) ){
            $param["text"] = $text;
        }
        //价格由低到高,排序规则，1.价格由低到高 2.价格由高到低 3.新上传的在前面 4.新上传的在后面 5.星星由高到低 0.默认排序
        $orderBy = $this->_post("orderBy", "intval");
        if( $orderBy == 1 ){
            $param["orderCode"] = 1;
        }else{
            $param["orderCode"] = 0;
        }
        //同名标仅显示一个类别
        $distinct = $this->_post("distinct", "intval");
        if( $distinct == 1 ){
            $param["distinct"] = true;
        }else{
            $param["distinct"] = false;
        }
        //价格区间类型
        $priceType = $this->_post("priceType","intval");
        //自定义开始价格
        $priceStart = $this->_post("priceMin","intval");
        //自定义结束价格
        $priceEnd = $this->_post("priceMax","intval");
        if( $priceType >= 1 && $priceType <= 6 && $priceStart == 0 && $priceEnd == 0 ){
            if( $priceType == 1 ){
                $param["priceStart"] = $this->getPriceParam('ps', 0);
                $param["priceEnd"] = $this->getPriceParam('pe', 3000);
            }elseif( $priceType == 2 ){
                $param["priceStart"] = $this->getPriceParam('ps', 3000);
                $param["priceEnd"] = $this->getPriceParam('pe', 5000);
            }elseif( $priceType == 3 ){
                $param["priceStart"] = $this->getPriceParam('ps', 5000);
                $param["priceEnd"] = $this->getPriceParam('pe', 8000);
            }elseif( $priceType == 4 ){
                $param["priceStart"] = $this->getPriceParam('ps', 8000);
                $param["priceEnd"] = $this->getPriceParam('pe', 10000);
            }elseif( $priceType == 5 ){
                $param["priceStart"] = $this->getPriceParam('ps', 10000);
                $param["priceEnd"] = $this->getPriceParam('pe', 15000);
            }elseif( $priceType == 6 ){
                $param["priceStart"] = $this->getPriceParam('ps', 15000);
                $param["priceEnd"] = $this->getPriceParam('pe', 18000);
            }
        }
        //自定义价格筛选
        if( $priceType == 0 && ( $priceStart > 0 || $priceEnd > 0 ) ){
            //开始价格
            if ($priceStart > 0) {
                $param["priceStart"] = $this->getPriceParam('ps', $priceStart);
            }
            //结束价格
            if ($priceEnd > 0) {
                $param["priceEnd"] = $this->getPriceParam('pe', $priceEnd);
            }
        }
        //屏蔽3万以上的标的
        if( !isset($param["priceEnd"]) || intval($param["priceEnd"]) > 18000 ){
            $param["priceEnd"] = 18000;
        }
        //商标类别 array
        $leis = $_POST["cateIds"];
        if( is_array($leis) ) {
            foreach ($leis as $k => $v) $leis[$k] = intval($v);
            $leiStr = implode(",", $leis);
            $param["leis"] = $leiStr;
        }
        //类似群组 array
        $teams = $_POST["teams"];
        if( is_array($teams) ){
            foreach ($teams as $k => $v) $teams[$k] = htmlspecialchars($v);
            $teamStr = implode(",", $teams);
            $param["teams"] = $teamStr;
        }
        //产品/服务
        $goods = $_POST["goods"];
        if( is_array($goods) ){
            $param["goodsName"] = implode(" ", $goods);
        }
        //名称组合类型 array
        $nameTypes = $_POST["nameTypes"];
        if( is_array($nameTypes) ){
            $param["types"] = implode(",", $nameTypes);
        }
        //名称字数 array
        $nameSize = $_POST["nameSize"];
        if( is_array($nameSize) ){
            $param["nameSizeList"] = implode(",", $nameSize);
        }
        //名称结构 array
        $abTypes = $_POST["abTypes"];
        if( is_array($abTypes) ){
            $param["abTypes"] = implode(",", $abTypes);
        }
        //申请人类型 1、公司，2、个人
        $sqType = $this->_post("sqType", "intval");
        if( $sqType == 1 || $sqType == 2 ){
            $param["sqType"] = $sqType;
        }
        //注册人申请量 1-80 【String】
        $sqNum = "1-80";//$this->_post("sqNum");
        if( !empty($sqNum) ){
            $param["sqNum"] = $sqNum;
        }
        //同名多类
        $md = $this->_post("md");
        if( !empty($md) ){
            $param["md"] = $md;
        }
        $url = 'https://biaobiaoku.com/api/search?' . http_build_query($param);
        //缓存初始化条件
        $cacheKey = "nonaodashi_mobile_" . md5($url);
        $cacheValue = $this->redis_cache->get($cacheKey);
        if( !empty($cacheValue) ){
            echo $cacheValue;
            exit;
        }
        $res = file_get_contents($url);
        $response = json_decode($res, true, JSON_UNESCAPED_UNICODE);
        $code = $response['code'];
        $msg = $response['msg'];
        if ($code == 0) {
            $total = $response['data']['total'];
            $list = $response['data']['results'];
            if (!empty($list)) {
                $vos = array();
                foreach ($list as $k => $v) {
                    $vos[$k]['id'] = $v['id'];
                    $vos[$k]['name'] = $v['name'];
                    $vos[$k]['lei'] = $v['lei'];
                    $vos[$k]['lei_name'] = $this->getCategory($v['lei']);
                    if( !empty($v['brother']) && strtolower($v['brother']) != 'null' ) {
                        $vos[$k]['brother_cate'] = explode(";",$v['brother']);
                        $vos[$k]['brother_cate'] = array_filter($vos[$k]['brother_cate'], function($value) {
                            return $value !== '';
                        });
                    }
                    if( !empty($v['team']) && strtolower($v['team']) != 'null' ) {
                        $vos[$k]['goods_sn'] = explode("；",$v['team']);
                        $vos[$k]['goods_sn'] = array_filter($vos[$k]['goods_sn'], function($value) {
                            return $value !== '';
                        });
                    }
                    $vos[$k]['count_goods_service'] = $v['xxNum'];
                    if( !empty($v['goods']) && strtolower($v['goods']) != 'null' ) {
                        $vos[$k]['goods_service'] = explode("；",$v['goods']);
                        $vos[$k]['goods_service'] = array_filter($vos[$k]['goods_service'], function($value) {
                            return $value !== '';
                        });
                    }
                    //计算最新价格
                    $newprice = intval($v['price'] * (100 + $this->buyFasterRate) / 100);
                    if( $newprice < ($v['price'] + $this->buyFasterLow) ){
                        $vos[$k]['price'] = $v['price'] + $this->buyFasterLow;
                    }else if( $newprice > ($v['price'] + $this->buyFasterHigh) ){
                        $vos[$k]['price'] = $v['price'] + $this->buyFasterHigh;
                    }else{
                        $vos[$k]['price'] = $newprice;
                    }
                    //$vos[$k]['thumb_image'] = "https://color.picer.cdn.biaobiaoku.com/" . $v['brandId'] . "-" . $v['picHash'] . "-250.png";
                    //$vos[$k]['trademark_image'] = "https://brand.picer.cdn.biaobiaoku.com/" . $v['brandId'] . "-" . $v['picHash'] . ".jpg";
                    $vos[$k]['thumb_image'] = $this->getImageUrl($v,2);
                    $vos[$k]['trademark_image'] = $this->getImageUrl($v,0);
                }
            }
            //响应
            $result = ['code' => 0, 'msg' => '', 'data' => ['total' => $total, 'list' => $vos]];
            $cacheValue = json_encode($result);
            $this->redis_cache->set($cacheKey, $cacheValue, 2);
            echo $cacheValue;
            exit;
        }
        echo json_encode(['code' => 0, 'msg' => $msg, 'data' => ['total' => 0, 'results' => []]]);
        exit;
    }

    public function productdetail(){
        $this->display('Mobile2024:productDetail');
    }

    public function getDetail(){
        $id = $this->_get('id','trim');
        $cacheKey = "nonaodashi_mobile_".$id;
        $jsonData = $this->redis_cache->get($cacheKey);
        $trademark = json_decode($jsonData,true);
        if( empty($trademark) ){
            $ip = empty($_SERVER["REMOTE_ADDR"]) ? "47.102.187.210" : $_SERVER["REMOTE_ADDR"];
            $url = 'https://biaobiaoku.com/api/get-info-by-id?id='.$id."&ip=".$ip;
            $res = file_get_contents($url);
            $response = json_decode($res,true,JSON_UNESCAPED_UNICODE);
            $code = $response['code'];
            if( $code == 0 ){
                $trademark = $response['data'];
                $this->redis_cache->setex($cacheKey, 3600 * 2, json_encode($trademark));
            }
        }
        if( empty($trademark) ){
            $where = array();
            $where['relateid'] = $id;
            $where['is_deleted'] = 0;
            $info = M("trademarks_best")->where($where)->find();
            if( !empty($info) ){
                $data = array();
                $data['is_deleted'] = 1;
                $data['remark'] = "获取商标仓库商标信息失败！反馈内容为空！";
                $data['update_at'] = date("Y-m-d H:i:s");
                $data['deleted_at'] = date("Y-m-d H:i:s");
                M("trademarks_best")->where($where)->save($data);
            }
            echo json_encode(['code' => -1, 'msg' => "商标信息不存在", 'data' => []],JSON_UNESCAPED_UNICODE);
            exit;
        }
        /**
         * 商标价格
         */
        $price = $trademark['price'];
        $newprice = intval($price * (100 + $this->buyFasterRate) / 100);
        if( $newprice < ($price + $this->buyFasterLow) ){
            $trademark['price'] = $price + $this->buyFasterLow;
        }else if( $newprice > ($price + $this->buyFasterHigh) ){
            $trademark['price'] = $price + $this->buyFasterHigh;
        }else{
            $trademark['price'] = $newprice;
        }
        //处理商标图片
        //$trademark['thumb_image'] = "https://color.picer.cdn.biaobiaoku.com/".$trademark['brandId']."-".$trademark['picHash']."-250.png";
        //$trademark['trademark_image'] = "https://brand.picer.cdn.biaobiaoku.com/".$trademark['brandId']."-".$trademark['picHash'].".jpg";
        $trademark['thumb_image'] = $this->getImageUrl($trademark,2);
        $trademark['trademark_image'] = $this->getImageUrl($trademark,0);
        //处理同名多类
        if( !empty($trademark['brother']) && strtolower($trademark['brother']) != 'null' ){
            $brolist = explode(";",$trademark['brother']);
            $brolist = array_filter($brolist, function($value) {
                return $value !== '';
            });
            $trademark['brotherCount'] = count( array_filter($brolist) );
        }else{
            $trademark['brother'] = "";
            $trademark['brotherCount'] = 1;
        }
        $trademark['lei_name'] = $this->getCategory($trademark['lei']);
        if( !empty($trademark['sqName']) ){
            $trademark['sqName'] = hideusername($trademark['sqName']);
        }
        $concat = array();
        $concat['user_name'] = "商标顾问 小闹";
        $concat['mobile'] = "13838111503";
        $concat['qrcode_url'] = 'https://naonaodashi.com/static/img/guwen.jpg?v=20240707';
        $trademark['concat'] = $concat;
        echo json_encode(['code' => 0, 'msg' => "", 'data' => $trademark],JSON_UNESCAPED_UNICODE);
        exit;
    }

    private function getPriceParam($type, $price){
        //开始价格
        if( $type == 'ps' ){
            $newprice = intval($price * 100 / ( 100 + $this->buyFasterRate ));
            if( $price - $newprice > $this->buyFasterHigh ){
                return $price - $this->buyFasterHigh - 0;
            }elseif( $price - $newprice < $this->buyFasterLow ){
                return $price - $this->buyFasterLow - 0;
            }else{
                return $newprice - 0;
            }
        }
        //结束价格
        if( $type == 'pe' ){
            $newprice = intval($price * 100 / ( 100 + $this->buyFasterRate ));
            if( $price - $newprice > $this->buyFasterHigh ){
                return $price - $this->buyFasterHigh - 0;
            }elseif( $price - $newprice < $this->buyFasterLow ){
                return $price - $this->buyFasterLow - 0;
            }else{
                return $newprice - 0;
            }
        }
    }

    public function process(){
        $this->display('Mobile2024:process');
    }

    public function contact(){
        $this->display('Mobile2024:contact');
    }

    private function getCategoryDetail(){
        $category = $this->getCategory();
        foreach ($category as $k => $v) {
            $wordlist = json_decode($v['word'],true);
            foreach ($wordlist as $key => $val) {
                $newk = explode('-',$val['k']);
                $wordlist[$key]['k'] = $newk[0];
                $wordlist[$key]['tv'] = $newk[1];
            }
            $category[$k]['word'] = $wordlist;
            $category[$k]['similar'] = json_decode($v['similar'],true);
        }
        return $category;
    }

}